<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta http-equiv="cache-control" content="no-cache">
<title>Genivia - MIME attachment functions</title>
<link href="genivia_tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="genivia_content.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="top">
 <div id="titlearea">
  <table height="72px" width="100%" cellspacing="0" cellpadding="0">
   <tbody>
    <tr>
     <td width="10%">&nbsp;</td>
     <td width="175px"><a href="https://www.genivia.com"><img alt="Genivia" src="GeniviaLogo2_trans_noslogan.png"/></a></td>
     <td class="tab_home"><a href="https://www.genivia.com">Home</a></td>
     <td class="tab_home"><a href="https://www.genivia.com/docs.html">Documentation</a></td>
     <td>
      <div style="float: right; font-size: 18px; font-weight: bold;">MIME attachment functions</div>
      <br>
      <div style="float: right; font-size: 10px;">updated Thu Dec 23 2021 by Robert van Engelen</div>
     </td>
     <td width="10%">&nbsp;</td>
    </tr>
   </tbody>
  </table>
 </div>
<!-- Generated by Doxygen 1.8.11 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__mime.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">MIME attachment functions</div>  </div>
</div><!--header-->
<div class="contents">

<p>This module defines functions to set and get MIME/MTOM attachments.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structsoap__mime.html">soap_mime</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stores a linked list of MIME attachments received.  <a href="structsoap__mime.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structsoap__multipart.html">soap_multipart</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">DIME/MIME/MTOM attachment data received by the engine.  <a href="structsoap__multipart.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:ga3fec7633da07bff2bf5fd6330bef1844"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mime.html#ga3fec7633da07bff2bf5fd6330bef1844">soap_mime_encoding</a> { <br />
&#160;&#160;<a class="el" href="group__group__mime.html#gga3fec7633da07bff2bf5fd6330bef1844a974209a86acc850e3c3d4beb8e579e8c">SOAP_MIME_NONE</a>, 
<a class="el" href="group__group__mime.html#gga3fec7633da07bff2bf5fd6330bef1844af26108ff0cee7079939a79df27f09e04">SOAP_MIME_7BIT</a>, 
<a class="el" href="group__group__mime.html#gga3fec7633da07bff2bf5fd6330bef1844a01939ddb661bb1c67dd6093999e0a814">SOAP_MIME_8BIT</a>, 
<a class="el" href="group__group__mime.html#gga3fec7633da07bff2bf5fd6330bef1844a980f093599dc29767fcdc0d90723dda1">SOAP_MIME_BINARY</a>, 
<br />
&#160;&#160;<a class="el" href="group__group__mime.html#gga3fec7633da07bff2bf5fd6330bef1844a29ca0d454ae623f793e9cf6c11c828f2">SOAP_MIME_QUOTED_PRINTABLE</a>, 
<a class="el" href="group__group__mime.html#gga3fec7633da07bff2bf5fd6330bef1844a8be678e012a0b38ed7600ba7ce7168a1">SOAP_MIME_BASE64</a>, 
<a class="el" href="group__group__mime.html#gga3fec7633da07bff2bf5fd6330bef1844a5b4f81d33dfa9ceff6e541a3735095ff">SOAP_MIME_IETF_TOKEN</a>, 
<a class="el" href="group__group__mime.html#gga3fec7633da07bff2bf5fd6330bef1844aeb0581a99f8d2706f43677755bb9866a">SOAP_MIME_X_TOKEN</a>
<br />
 }<tr class="memdesc:ga3fec7633da07bff2bf5fd6330bef1844"><td class="mdescLeft">&#160;</td><td class="mdescRight">RFC2045 MIME content transfer encodings.  <a href="group__group__mime.html#ga3fec7633da07bff2bf5fd6330bef1844">More...</a><br /></td></tr>
</td></tr>
<tr class="separator:ga3fec7633da07bff2bf5fd6330bef1844"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga39e5da4f375e8030b8cbddaf0a2a8e6e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mime.html#ga39e5da4f375e8030b8cbddaf0a2a8e6e">soap_set_mime_attachment</a> (struct <a class="el" href="structsoap.html">soap</a> *<a class="el" href="structsoap.html">soap</a>, const char *ptr, size_t size, enum <a class="el" href="group__group__mime.html#ga3fec7633da07bff2bf5fd6330bef1844">soap_mime_encoding</a> encoding, const char *type, const char *id, const char *location, const char *description)</td></tr>
<tr class="memdesc:ga39e5da4f375e8030b8cbddaf0a2a8e6e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a MIME attachment to the SOAP/XML message.  <a href="#ga39e5da4f375e8030b8cbddaf0a2a8e6e">More...</a><br /></td></tr>
<tr class="separator:ga39e5da4f375e8030b8cbddaf0a2a8e6e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9180e5ba634b20305b755b410045d9ee"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mime.html#ga9180e5ba634b20305b755b410045d9ee">soap_set_mime</a> (struct <a class="el" href="structsoap.html">soap</a> *<a class="el" href="structsoap.html">soap</a>, const char *boundary, const char *start)</td></tr>
<tr class="memdesc:ga9180e5ba634b20305b755b410045d9ee"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable MIME attachments.  <a href="#ga9180e5ba634b20305b755b410045d9ee">More...</a><br /></td></tr>
<tr class="separator:ga9180e5ba634b20305b755b410045d9ee"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga81cedb24670ebda48a79679d4682211f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mime.html#ga81cedb24670ebda48a79679d4682211f">soap_clr_mime</a> (struct <a class="el" href="structsoap.html">soap</a> *<a class="el" href="structsoap.html">soap</a>)</td></tr>
<tr class="memdesc:ga81cedb24670ebda48a79679d4682211f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable MIME attachments.  <a href="#ga81cedb24670ebda48a79679d4682211f">More...</a><br /></td></tr>
<tr class="separator:ga81cedb24670ebda48a79679d4682211f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga57cf2a958b2ce6e957895642cd4c0966"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mime.html#ga57cf2a958b2ce6e957895642cd4c0966">soap_post_check_mime_attachments</a> (struct <a class="el" href="structsoap.html">soap</a> *<a class="el" href="structsoap.html">soap</a>)</td></tr>
<tr class="memdesc:ga57cf2a958b2ce6e957895642cd4c0966"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable post-processing of MIME/MTOM attachments.  <a href="#ga57cf2a958b2ce6e957895642cd4c0966">More...</a><br /></td></tr>
<tr class="separator:ga57cf2a958b2ce6e957895642cd4c0966"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf2cb661a31f0cc431a3738125ddedb8f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mime.html#gaf2cb661a31f0cc431a3738125ddedb8f">soap_check_mime_attachments</a> (struct <a class="el" href="structsoap.html">soap</a> *<a class="el" href="structsoap.html">soap</a>)</td></tr>
<tr class="memdesc:gaf2cb661a31f0cc431a3738125ddedb8f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check for a MIME/MTOM attachment.  <a href="#gaf2cb661a31f0cc431a3738125ddedb8f">More...</a><br /></td></tr>
<tr class="separator:gaf2cb661a31f0cc431a3738125ddedb8f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga117fe70b589a08a9fa9ad06c3f5bd009"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structsoap__multipart.html">soap_multipart</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mime.html#ga117fe70b589a08a9fa9ad06c3f5bd009">soap_recv_mime_attachment</a> (struct <a class="el" href="structsoap.html">soap</a> *<a class="el" href="structsoap.html">soap</a>, void *handle)</td></tr>
<tr class="memdesc:ga117fe70b589a08a9fa9ad06c3f5bd009"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a MIME/MTOM attachment.  <a href="#ga117fe70b589a08a9fa9ad06c3f5bd009">More...</a><br /></td></tr>
<tr class="separator:ga117fe70b589a08a9fa9ad06c3f5bd009"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>This module defines functions to set and get MIME/MTOM attachments. </p>
<p>To enable MIME or MTOM, first initialize the <code><a class="el" href="structsoap.html" title="Context with the engine state. ">soap</a></code> context with <code><a class="el" href="group__group__flags.html#ga988c0f4d52bf6f5cdac8c0e197ebe62a" title="soap_mode ENC output flag value to enable MIME attachments in messages to be sent, receiving is automatic ">SOAP_ENC_MIME</a></code> (for MIME) or <code><a class="el" href="group__group__flags.html#gac510f1f7c80fa8a3f20afa2dcfb53fb3" title="soap_mode ENC output flag value to enable MTOM XOP attachments in messages to be sent, receiving is automatic ">SOAP_ENC_MTOM</a></code> (for MTOM) using <code><a class="el" href="group__group__context.html#ga51cde138234ed7ec8c4e25bdf6418658" title="Allocate and initialize a new soap context with input and output soap_mode flags. ...">soap_new1</a></code>, <code><a class="el" href="group__group__context.html#gac87126c3e45d2fda488e9832c2dd5be1" title="Initialize a stack-allocated soap context with input and output soap_mode flags. ">soap_init1</a></code>, <code><a class="el" href="group__group__context.html#ga84f52a67a41009b260ff2c036df7f6ab" title="Set input and output soap_mode flags of the given soap context. ">soap_set_mode</a></code>, or <code><a class="el" href="group__group__mime.html#ga9180e5ba634b20305b755b410045d9ee" title="Enable MIME attachments. ">soap_set_mime</a></code> to enable MIME and also to set a start id. To disable MIME use <code><a class="el" href="group__group__mime.html#ga81cedb24670ebda48a79679d4682211f" title="Disable MIME attachments. ">soap_clr_mime</a></code>.</p>
<p>There are two ways to add MIME/MTOM attachments to SOAP/XML messages for sending:</p><ul>
<li>use <code><a class="el" href="group__group__mime.html#ga39e5da4f375e8030b8cbddaf0a2a8e6e" title="Add a MIME attachment to the SOAP/XML message. ">soap_set_mime_attachment</a></code> to explicitly add an attachment that contains the specified source of data;</li>
<li>use <code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code> (MIME and MTOM) or <code><a class="el" href="struct__xop_____include.html" title="XOP include structure with attachment data. ">_xop__Include</a></code> (MTOM) structures in the serializable data of a SOAP/XML message, where the specified data is serialized in MIME/MTOM attachments automatically when one of the <code>id</code>, <code>type</code> or <code>options</code> member variables are non-NULL.</li>
</ul>
<p>Both methods also support streaming MIME attachments to send using the <code><a class="el" href="group__group__callbacks.html#ga610f2a6a56d5ad04cb5124440a5de1dc" title="Callback to open a streaming MIME/MTOM attachment for reading. ">soap::fmimereadopen</a></code>, <code><a class="el" href="group__group__callbacks.html#gaff40a1ca6fbf075b54ccbf479009ce74" title="Callback to read data in a MIME/MTOM attachment stream. ">soap::fmimeread</a></code>, and <code><a class="el" href="group__group__callbacks.html#ga884e94e8450f56049ba5071786170dd5" title="Callback to close a MIME/MTOM attachment stream after reading. ">soap::fmimereadclose</a></code> callbacks that fetch the data to send, where a user-defined handle should be specified for the <code>ptr</code> parameter of <code><a class="el" href="group__group__mime.html#ga39e5da4f375e8030b8cbddaf0a2a8e6e" title="Add a MIME attachment to the SOAP/XML message. ">soap_set_mime_attachment</a></code> or the <code><a class="el" href="structxsd____base64_binary.html#a6ba9f9e291b2b26e0696bd48f4e983be" title="pointer to binary data ">xsd__base64Binary::__ptr</a></code> member variable instead of a pointer to the actual data. This handle can be used by the callbacks to fetch the specific data to transmit.</p>
<p>Receiving MIME/MTOM attachments attached to SOAP/XML messages is automatic. The MIME/MTOM attachments are converted to binary data and stored in the <code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code> structures that reference the MIME/MTOM attachments via the <code><a class="el" href="structxsd____base64_binary.html#a6398e9d86079896facc3005871d7fe27" title="extra member: NULL to generate an id or assign this member variable a unique UUID ...">xsd__base64Binary::id</a></code> string, meaning that the <code><a class="el" href="structxsd____base64_binary.html#a6ba9f9e291b2b26e0696bd48f4e983be" title="pointer to binary data ">xsd__base64Binary::__ptr</a></code> (points to the data) and <code><a class="el" href="structxsd____base64_binary.html#aa2dfd4d99f8280c413b9ff25a69a8729" title="size of the binary data ">xsd__base64Binary::__size</a></code> (data length) are populated automatically with the MIME/MTOM binary data. However, if the streaming MIME callbacks <code><a class="el" href="group__group__callbacks.html#gaef809b275fd65e57991a80663288fa72" title="Callback to open a streaming MIME/MTOM attachment for writing. ">soap::fmimewriteopen</a></code>, <code><a class="el" href="group__group__callbacks.html#ga9084f0392e4a54287366121d30bc4830" title="Callback to write data in a MIME attachment stream. ">soap::fmimewrite</a></code>, and <code><a class="el" href="group__group__callbacks.html#ga8af884096b21cea1b69133843131a47b" title="Callback to close a MIME/MTOM attachment stream after writing. ">soap::fmimewriteclose</a></code> are defined then the attachments are streamed to these callbacks instead.</p>
<p>For example, to send and receive a SOAP/XML message with MIME attachments using a serializable <code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code> structure:</p>
<div class="fragment"><div class="line"><span class="comment">// example .h file for soapcpp2</span></div><div class="line"><span class="comment">//gsoap ns service name: example</span></div><div class="line"><span class="comment">//gsoap ns service namespace: urn:example</span></div><div class="line"><span class="keyword">struct </span><a class="code" href="structxsd____base64_binary.html">xsd__base64Binary</a> {</div><div class="line">  <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> *<a class="code" href="structxsd____base64_binary.html#a6ba9f9e291b2b26e0696bd48f4e983be">__ptr</a>; <span class="comment">// pointer to binary data</span></div><div class="line">  <span class="keywordtype">int</span> <a class="code" href="structxsd____base64_binary.html#aa2dfd4d99f8280c413b9ff25a69a8729">__size</a>;           <span class="comment">// size of the binary data</span></div><div class="line">  <span class="keywordtype">char</span> *<a class="code" href="structxsd____base64_binary.html#a6398e9d86079896facc3005871d7fe27">id</a>;             <span class="comment">// NULL to generate an id or assign this member variable a unique UUID</span></div><div class="line">  <span class="keywordtype">char</span> *<a class="code" href="structxsd____base64_binary.html#acbc2d7ba24334ccc4f8ec36e9122e9e5">type</a>;           <span class="comment">// MIME type of the data</span></div><div class="line">  <span class="keywordtype">char</span> *<a class="code" href="structxsd____base64_binary.html#a16d2bb03d68bf276bad5fd7cccd55bbe">options</a>;        <span class="comment">// DIME options or an optional description of the MIME attachment</span></div><div class="line">};</div><div class="line"><span class="keywordtype">int</span> ns__webmethod(<span class="keyword">struct</span> <a class="code" href="structxsd____base64_binary.html">xsd__base64Binary</a> *data, <span class="keyword">struct</span> <a class="code" href="structxsd____base64_binary.html">xsd__base64Binary</a> *result);</div></div><!-- fragment --><div class="fragment"><div class="line"><span class="comment">// example client implementation based on the above example .h file for soapcpp2</span></div><div class="line"><span class="preprocessor">#include &quot;soapH.h&quot;</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">  <span class="keyword">struct </span>soap *soap = <a class="code" href="group__group__context.html#ga87c20488b2dc680aaa7689b1d024989c">soap_new</a>();</div><div class="line">  <span class="keyword">struct </span><a class="code" href="structxsd____base64_binary.html">xsd__base64Binary</a> data, result;</div><div class="line">  data.<a class="code" href="structxsd____base64_binary.html#a6ba9f9e291b2b26e0696bd48f4e983be">__ptr</a> = ...;  <span class="comment">// points to binary image data to send</span></div><div class="line">  data.__size = ...; <span class="comment">// size of the image data to send</span></div><div class="line">  data.id = <a class="code" href="group__group__context.html#ga41747ef145667bdff9c66cdd2bc86653">soap_strdup</a>(soap, <a class="code" href="group__group__misc.html#ga5fcf3c8f6f4bc6d5e6efd7a92ceaf399">soap_rand_uuid</a>(soap, NULL));</div><div class="line">  data.type = <span class="stringliteral">&quot;image/jpg&quot;</span>;</div><div class="line">  data.options = <span class="stringliteral">&quot;A picture&quot;</span>;</div><div class="line">  <span class="keywordflow">if</span> (soap_call_ns__webmethod(soap, endpoint, NULL, &amp;data, &amp;result))</div><div class="line">    <a class="code" href="group__group__fault.html#ga931a4ab6df2553b48a0c270f8a0a88af">soap_print_fault</a>(soap, stderr);</div><div class="line">  <span class="keywordflow">else</span></div><div class="line">    ... <span class="comment">// success, use the result</span></div><div class="line">  <a class="code" href="group__group__context.html#gaf7d0176161e9def36981e24faa1913d9">soap_destroy</a>(soap);</div><div class="line">  <a class="code" href="group__group__context.html#ga81a009ae1ea825a05e5241e2b7a8ece9">soap_end</a>(soap);</div><div class="line">  <a class="code" href="group__group__context.html#ga57108ca4681186e58b5b189c3528f10a">soap_free</a>(soap);</div><div class="line">}</div></div><!-- fragment --><div class="fragment"><div class="line"><span class="comment">// example service implementation based on the above example .h file for soapcpp2</span></div><div class="line"><span class="preprocessor">#include &quot;soapH.h&quot;</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">  <span class="keyword">struct </span>soap *soap = <a class="code" href="group__group__context.html#ga87c20488b2dc680aaa7689b1d024989c">soap_new</a>();</div><div class="line">  ... <span class="comment">// serve requests with soap_bind, soap_accept, soap_ssl_accept, and soap_serve</span></div><div class="line">}</div><div class="line"><span class="keywordtype">int</span> ns__webmethod(<span class="keyword">struct</span> soap *soap, <span class="keyword">struct</span> <a class="code" href="structxsd____base64_binary.html">xsd__base64Binary</a> *data, <span class="keyword">struct</span> <a class="code" href="structxsd____base64_binary.html">xsd__base64Binary</a> *result)</div><div class="line">{</div><div class="line">  <span class="comment">// echo back the structure (as a MIME attachment)</span></div><div class="line">  result-&gt;<a class="code" href="structxsd____base64_binary.html#a6ba9f9e291b2b26e0696bd48f4e983be">__ptr</a> = data-&gt;<a class="code" href="structxsd____base64_binary.html#a6ba9f9e291b2b26e0696bd48f4e983be">__ptr</a>;</div><div class="line">  result-&gt;<a class="code" href="structxsd____base64_binary.html#aa2dfd4d99f8280c413b9ff25a69a8729">__size</a> = data-&gt;<a class="code" href="structxsd____base64_binary.html#aa2dfd4d99f8280c413b9ff25a69a8729">__size</a>;</div><div class="line">  retult-&gt;id = data-&gt;<a class="code" href="structxsd____base64_binary.html#a6398e9d86079896facc3005871d7fe27">id</a>;</div><div class="line">  retult-&gt;type = data-&gt;<a class="code" href="structxsd____base64_binary.html#acbc2d7ba24334ccc4f8ec36e9122e9e5">type</a>;</div><div class="line">  retult-&gt;options = data-&gt;<a class="code" href="structxsd____base64_binary.html#a16d2bb03d68bf276bad5fd7cccd55bbe">options</a>;</div><div class="line">  <span class="keywordflow">return</span> <a class="code" href="group__group__errors.html#ga3b10a68f354f39cbb0fe0d043ad4c7c0">SOAP_OK</a>;</div><div class="line">}</div></div><!-- fragment --><p>To send MIME attachments without SOAP/XML (i.e. with REST methods), simply add attachments with <code><a class="el" href="group__group__mime.html#ga39e5da4f375e8030b8cbddaf0a2a8e6e" title="Add a MIME attachment to the SOAP/XML message. ">soap_set_mime_attachment</a></code>. The <code><a class="el" href="group__group__io.html#ga290ddb46afdbf5ec6669b6ac8daca5c9" title="Finalize the context after sending. ">soap_end_send</a></code> function then adds the attachments before finalizing the message transmission. To receive MIME attachments without SOAP/XML (i.e. with REST methods), simply call <code><a class="el" href="group__group__io.html#gaf4ce538944f65ac97d82bfeaa9345c42" title="Initialize the context for receiving. ">soap_begin_recv</a></code> (not needed at the server side since this is already called to parse the HTTP header) and <code><a class="el" href="group__group__io.html#ga86b0c04e8baa911fc57e7f1220f9eb8f" title="Finalize the context after receiving. ">soap_end_recv</a></code>.</p>
<p>For example a client-side multipart-related POST operation that sends a multipart-related message with one MIME attachment and receives a message consisting of multipart-related MIME attachments:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;soapH.h&quot;</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">  <span class="keyword">struct </span>soap *soap = <a class="code" href="group__group__context.html#ga87c20488b2dc680aaa7689b1d024989c">soap_new</a>();</div><div class="line">  <span class="keyword">const</span> <span class="keywordtype">char</span> *ptr = <span class="stringliteral">&quot;&lt;attached&gt;Some attached text&lt;/attached&gt;&quot;</span>;</div><div class="line">  <span class="keywordtype">size_t</span> size = strlen(ptr);</div><div class="line">  <a class="code" href="group__group__mime.html#ga9180e5ba634b20305b755b410045d9ee">soap_set_mime</a>(soap, NULL, <span class="stringliteral">&quot;body&quot;</span>);</div><div class="line">  <a class="code" href="group__group__mime.html#ga39e5da4f375e8030b8cbddaf0a2a8e6e">soap_set_mime_attachment</a>(soap, ptr, size, <a class="code" href="group__group__mime.html#gga3fec7633da07bff2bf5fd6330bef1844a974209a86acc850e3c3d4beb8e579e8c">SOAP_MIME_NONE</a>, <span class="stringliteral">&quot;text/xml&quot;</span>, <span class="stringliteral">&quot;attach1&quot;</span>, NULL, NULL);</div><div class="line">  <span class="keywordflow">if</span> (<a class="code" href="group__group__io.html#gaf502246613cb6d4ea120965065d8c0b2">soap_POST</a>(soap, <span class="stringliteral">&quot;http://&quot;</span>, NULL, <span class="stringliteral">&quot;text/xml&quot;</span>)</div><div class="line">   || <a class="code" href="group__group__io.html#ga7712f5bc36127050a11ad995d0593bdc">soap_send</a>(soap, <span class="stringliteral">&quot;&lt;doc title=\&quot;Example\&quot;&gt;Some text&lt;/doc&gt;&quot;</span>)</div><div class="line">   || <a class="code" href="group__group__io.html#ga290ddb46afdbf5ec6669b6ac8daca5c9">soap_end_send</a>(soap)</div><div class="line">   || <a class="code" href="group__group__io.html#gaf4ce538944f65ac97d82bfeaa9345c42">soap_begin_recv</a>(soap)</div><div class="line">   || <a class="code" href="group__group__io.html#ga86b0c04e8baa911fc57e7f1220f9eb8f">soap_end_recv</a>(soap))</div><div class="line">  {</div><div class="line">    <a class="code" href="group__group__fault.html#ga931a4ab6df2553b48a0c270f8a0a88af">soap_print_fault</a>(soap, stderr);</div><div class="line">  }</div><div class="line">  <span class="keywordflow">else</span></div><div class="line">  {</div><div class="line">    <span class="keywordtype">int</span> n = 0;</div><div class="line">    <span class="keyword">struct </span><a class="code" href="structsoap__multipart.html">soap_multipart</a> *attachment;</div><div class="line">    <span class="keywordflow">for</span> (attachment = soap-&gt;<a class="code" href="structsoap.html#af2f4dbd6f73f19f1beeaa3a7e9d9cc2c">mime</a>.<a class="code" href="structsoap__mime.html#aeef725035ddedf24b29d1070e0f9bb33">list</a>; attachment; attachment = attachment-&gt;<a class="code" href="structsoap__multipart.html#a5521c92e49758ed873d0a8b2ec4b25c8">next</a>)</div><div class="line">    {</div><div class="line">      ++n;</div><div class="line">      printf(<span class="stringliteral">&quot;Part %d:\n&quot;</span>, n);</div><div class="line">      printf(<span class="stringliteral">&quot;ptr        =%p\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#a640f46b605042f37ae1592f77e31c52d">ptr</a>);</div><div class="line">      printf(<span class="stringliteral">&quot;size       =%ul\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#afc4b69f5e9ade6526b23681c105d5ca5">size</a>);</div><div class="line">      printf(<span class="stringliteral">&quot;id         =%s\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#ad0bcd79b40a1bc1dc13fc343477f5564">id</a> ? attachment-&gt;<a class="code" href="structsoap__multipart.html#ad0bcd79b40a1bc1dc13fc343477f5564">id</a> : <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">      printf(<span class="stringliteral">&quot;type       =%s\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#a495c8d20e0334be1b1345193ca2fb764">type</a> ? attachment-&gt;<a class="code" href="structsoap__multipart.html#a495c8d20e0334be1b1345193ca2fb764">type</a> : <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">      printf(<span class="stringliteral">&quot;location   =%s\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#af11a70ea80f3e1934d72b292e6d93910">location</a> ? attachment-&gt;<a class="code" href="structsoap__multipart.html#af11a70ea80f3e1934d72b292e6d93910">location</a> : <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">      printf(<span class="stringliteral">&quot;description=%s\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#ab527c6e6cce784c68a5bd9bb80845ca4">description</a> ? attachment-&gt;<a class="code" href="structsoap__multipart.html#ab527c6e6cce784c68a5bd9bb80845ca4">description</a> : <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">    }</div><div class="line">  }</div><div class="line">  <a class="code" href="group__group__mime.html#ga81cedb24670ebda48a79679d4682211f">soap_clr_mime</a>(soap);</div><div class="line">}</div></div><!-- fragment --><p>In C++ you can use an iterator for the last part of this example:</p>
<div class="fragment"><div class="line"><span class="keyword">struct </span>soap *soap = <a class="code" href="group__group__context.html#ga87c20488b2dc680aaa7689b1d024989c">soap_new</a>();</div><div class="line">... <span class="comment">// call soap_POST etc</span></div><div class="line"><span class="keywordtype">int</span> n = 0;</div><div class="line"><span class="keywordflow">for</span> (<a class="code" href="structsoap__multipart.html#ad9000ffe8f72fef89038c4773efdf575">soap_multipart::iterator</a> i = soap-&gt;<a class="code" href="structsoap.html#af2f4dbd6f73f19f1beeaa3a7e9d9cc2c">mime</a>.<a class="code" href="structsoap__mime.html#ae99fa19c5d24051a495b79a024a3f5f9">begin</a>(); i != soap-&gt;<a class="code" href="structsoap.html#af2f4dbd6f73f19f1beeaa3a7e9d9cc2c">mime</a>.<a class="code" href="structsoap__mime.html#af810e927cdbe61242f978918fc2de748">end</a>(); ++i)</div><div class="line">{</div><div class="line">  ++n;</div><div class="line">  printf(<span class="stringliteral">&quot;Part %d:\n&quot;</span>, n);</div><div class="line">  printf(<span class="stringliteral">&quot;ptr        =%p\n&quot;</span>, i-&gt;ptr);</div><div class="line">  ... <span class="comment">// etc</span></div><div class="line">}</div></div><!-- fragment --><p>At the server side the code to retrieve the REST message sent consisting of a set of multipart-related MIME attachments is the same. To respond with multipart-related MIME attachments use <code><a class="el" href="group__group__mime.html#ga9180e5ba634b20305b755b410045d9ee" title="Enable MIME attachments. ">soap_set_mime</a></code> and use <code><a class="el" href="group__group__mime.html#ga39e5da4f375e8030b8cbddaf0a2a8e6e" title="Add a MIME attachment to the SOAP/XML message. ">soap_set_mime_attachment</a></code> to add attachments. For example:</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;soapH.h&quot;</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">  <span class="keyword">struct </span>soap *soap = <a class="code" href="group__group__context.html#ga87c20488b2dc680aaa7689b1d024989c">soap_new</a>();</div><div class="line">  soap-&gt;<a class="code" href="group__group__callbacks.html#gae022204ff7004df2d5ac9e083cbb5b16">fget</a> = my_get; <span class="comment">// HTTP GET handler to serve HTTP GET</span></div><div class="line">  ... <span class="comment">// serve requests with soap_bind, soap_accept, soap_ssl_accept, and soap_serve</span></div><div class="line">}</div><div class="line"><span class="keywordtype">int</span> my_get(<span class="keyword">struct</span> soap *soap)</div><div class="line">{</div><div class="line">  <span class="keyword">const</span> <span class="keywordtype">char</span> *ptr = <span class="stringliteral">&quot;&lt;attached&gt;Some attached text&lt;/attached&gt;&quot;</span>;</div><div class="line">  <span class="keywordtype">size_t</span> size = strlen(ptr);</div><div class="line">  <a class="code" href="group__group__mime.html#ga9180e5ba634b20305b755b410045d9ee">soap_set_mime</a>(soap, NULL, <span class="stringliteral">&quot;body&quot;</span>);</div><div class="line">  <a class="code" href="group__group__mime.html#ga39e5da4f375e8030b8cbddaf0a2a8e6e">soap_set_mime_attachment</a>(soap, ptr, size, <a class="code" href="group__group__mime.html#gga3fec7633da07bff2bf5fd6330bef1844a974209a86acc850e3c3d4beb8e579e8c">SOAP_MIME_NONE</a>, <span class="stringliteral">&quot;text/xml&quot;</span>, <span class="stringliteral">&quot;attach1&quot;</span>, NULL, NULL);</div><div class="line">  soap-&gt;<a class="code" href="structsoap.html#ae5e98733a4349b5e1466a9e0ccc22c11">http_content</a> = <span class="stringliteral">&quot;text/xml&quot;</span>;</div><div class="line">  <span class="keywordflow">if</span> (<a class="code" href="group__group__io.html#ga0390e58bd2a3ebe6fe3a46de0534a614">soap_response</a>(soap, <a class="code" href="group__group__io.html#ga05be99343f556fe70940145e874cdb99">SOAP_FILE</a>)</div><div class="line">   || <a class="code" href="group__group__io.html#ga7712f5bc36127050a11ad995d0593bdc">soap_send</a>(soap, <span class="stringliteral">&quot;&lt;doc title=\&quot;Example\&quot;&gt;Some text&lt;/doc&gt;\n&quot;</span>)</div><div class="line">   || <a class="code" href="group__group__io.html#ga290ddb46afdbf5ec6669b6ac8daca5c9">soap_end_send</a>(soap))</div><div class="line">    <span class="keywordflow">return</span> <a class="code" href="group__group__io.html#ga06d59094afa3df6b1b9f6b2bb484207c">soap_closesock</a>(soap);</div><div class="line">  <a class="code" href="group__group__mime.html#ga81cedb24670ebda48a79679d4682211f">soap_clr_mime</a>(soap);</div><div class="line">  <span class="keywordflow">return</span> <a class="code" href="group__group__errors.html#ga3b10a68f354f39cbb0fe0d043ad4c7c0">SOAP_OK</a>;</div><div class="line">}</div></div><!-- fragment --><p>To disable MIME again, use <code><a class="el" href="group__group__mime.html#ga81cedb24670ebda48a79679d4682211f" title="Disable MIME attachments. ">soap_clr_mime</a></code>. </p>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a class="anchor" id="ga3fec7633da07bff2bf5fd6330bef1844"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__group__mime.html#ga3fec7633da07bff2bf5fd6330bef1844">soap_mime_encoding</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>RFC2045 MIME content transfer encodings. </p>
<p>These values are used by the <code><a class="el" href="group__group__mime.html#ga39e5da4f375e8030b8cbddaf0a2a8e6e" title="Add a MIME attachment to the SOAP/XML message. ">soap_set_mime_attachment</a></code> function parameter <code>encoding</code>.</p>
<dl class="section warning"><dt>Warning</dt><dd>You are responsible to ensure that the MIME/MTOM content conforms to the encoding specified. We recommend <code><a class="el" href="group__group__mime.html#gga3fec7633da07bff2bf5fd6330bef1844a974209a86acc850e3c3d4beb8e579e8c" title="no encoding, raw data content (recommended) ">SOAP_MIME_NONE</a></code> to transmit any data of any type which is usually the purpose of MIME/MTOM attachments to SOAP/XML.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><code><a class="el" href="group__group__mime.html#ga39e5da4f375e8030b8cbddaf0a2a8e6e" title="Add a MIME attachment to the SOAP/XML message. ">soap_set_mime_attachment</a></code>. </dd></dl>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="gga3fec7633da07bff2bf5fd6330bef1844a974209a86acc850e3c3d4beb8e579e8c"></a>SOAP_MIME_NONE&#160;</td><td class="fielddoc">
<p>no encoding, raw data content (recommended) </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gga3fec7633da07bff2bf5fd6330bef1844af26108ff0cee7079939a79df27f09e04"></a>SOAP_MIME_7BIT&#160;</td><td class="fielddoc">
<p>7 bit data content </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gga3fec7633da07bff2bf5fd6330bef1844a01939ddb661bb1c67dd6093999e0a814"></a>SOAP_MIME_8BIT&#160;</td><td class="fielddoc">
<p>8 bit data content </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gga3fec7633da07bff2bf5fd6330bef1844a980f093599dc29767fcdc0d90723dda1"></a>SOAP_MIME_BINARY&#160;</td><td class="fielddoc">
<p>binary raw data content </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gga3fec7633da07bff2bf5fd6330bef1844a29ca0d454ae623f793e9cf6c11c828f2"></a>SOAP_MIME_QUOTED_PRINTABLE&#160;</td><td class="fielddoc">
<p>data is formatted as quoted printable </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gga3fec7633da07bff2bf5fd6330bef1844a8be678e012a0b38ed7600ba7ce7168a1"></a>SOAP_MIME_BASE64&#160;</td><td class="fielddoc">
<p>data is formatted in base64 </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gga3fec7633da07bff2bf5fd6330bef1844a5b4f81d33dfa9ceff6e541a3735095ff"></a>SOAP_MIME_IETF_TOKEN&#160;</td><td class="fielddoc">
<p>data is an IETF token </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gga3fec7633da07bff2bf5fd6330bef1844aeb0581a99f8d2706f43677755bb9866a"></a>SOAP_MIME_X_TOKEN&#160;</td><td class="fielddoc">
<p>data is an X-token </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="gaf2cb661a31f0cc431a3738125ddedb8f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int soap_check_mime_attachments </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structsoap.html">soap</a> *&#160;</td>
          <td class="paramname"><em>soap</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Check for a MIME/MTOM attachment. </p>
<p>This function checks the presence of a MIME/MTOM attachment after calling a service operation by returning nonzero when attachments are present. Returns nonzero if attachments are present. Requires <code><a class="el" href="group__group__mime.html#ga57cf2a958b2ce6e957895642cd4c0966" title="Enable post-processing of MIME/MTOM attachments. ">soap_post_check_mime_attachments</a></code>.</p>
<dl class="section see"><dt>See also</dt><dd><code><a class="el" href="group__group__mime.html#ga57cf2a958b2ce6e957895642cd4c0966" title="Enable post-processing of MIME/MTOM attachments. ">soap_post_check_mime_attachments</a></code>.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>nonzero if MIME/MTOM attachments are present </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">soap</td><td><code><a class="el" href="structsoap.html" title="Context with the engine state. ">soap</a></code> context </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga81cedb24670ebda48a79679d4682211f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void soap_clr_mime </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structsoap.html">soap</a> *&#160;</td>
          <td class="paramname"><em>soap</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disable MIME attachments. </p>
<p>This function disables MIME attachments such as after sending a multipart-related message with attachments to switch back to non-multipart-related messaging, unless the data to serialize as a message contains attachments such as <code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code> for MIME attachments and <code><a class="el" href="struct__xop_____include.html" title="XOP include structure with attachment data. ">_xop__Include</a></code> for MTOM attachments.</p>
<dl class="section see"><dt>See also</dt><dd><code><a class="el" href="group__group__mime.html#ga9180e5ba634b20305b755b410045d9ee" title="Enable MIME attachments. ">soap_set_mime</a></code>, <code><a class="el" href="group__group__mime.html#ga39e5da4f375e8030b8cbddaf0a2a8e6e" title="Add a MIME attachment to the SOAP/XML message. ">soap_set_mime_attachment</a></code>, <code><a class="el" href="group__group__flags.html#ga988c0f4d52bf6f5cdac8c0e197ebe62a" title="soap_mode ENC output flag value to enable MIME attachments in messages to be sent, receiving is automatic ">SOAP_ENC_MIME</a></code>, <code><a class="el" href="group__group__flags.html#gac510f1f7c80fa8a3f20afa2dcfb53fb3" title="soap_mode ENC output flag value to enable MTOM XOP attachments in messages to be sent, receiving is automatic ">SOAP_ENC_MTOM</a></code>. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">soap</td><td><code><a class="el" href="structsoap.html" title="Context with the engine state. ">soap</a></code> context </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga57cf2a958b2ce6e957895642cd4c0966"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int soap_post_check_mime_attachments </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structsoap.html">soap</a> *&#160;</td>
          <td class="paramname"><em>soap</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enable post-processing of MIME/MTOM attachments. </p>
<p>This function enables post-processing of MTOM/MIME attachments attached to a message and is useful when MIME/MTOM are streamed (asynchronously) by configuring the callbacks <code>::fmimewriteopen</code>, <code><a class="el" href="group__group__callbacks.html#ga9084f0392e4a54287366121d30bc4830" title="Callback to write data in a MIME attachment stream. ">soap::fmimewrite</a></code>, and <code><a class="el" href="group__group__callbacks.html#ga8af884096b21cea1b69133843131a47b" title="Callback to close a MIME/MTOM attachment stream after writing. ">soap::fmimewriteclose</a></code> to write the attachment to memory, file or, other resources. By calling this function, the presence of MIME/MTOM attachments must be explicitly checked after each message is received by calling <code><a class="el" href="group__group__mime.html#gaf2cb661a31f0cc431a3738125ddedb8f" title="Check for a MIME/MTOM attachment. ">soap_check_mime_attachments</a></code>. When this function returns nonzero (true), <code><a class="el" href="group__group__mime.html#ga117fe70b589a08a9fa9ad06c3f5bd009" title="Get a MIME/MTOM attachment. ">soap_recv_mime_attachment</a></code> must be called repeatedly to retrieve each attachment until this function returns NULL indicating the end of attachments and the channel is closed, or if an error occurred with <code><a class="el" href="structsoap.html#ab85f5d42702963d13ea540bd9876e6d2" title="The soap context soap_status (int) error code of the last operation or SOAP_OK (zero) ...">soap::error</a></code> set to a nonzero <code><a class="el" href="group__group__errors.html#gac0eadf8f72bacb5b41b750beaeca0444" title="Status and error codes are int values, a zero value or SOAP_OK (0) means no error, nonzero means error. ">soap_status</a></code> error code.</p>
<p>If attachments are not referenced by the SOAP/XML message received, then normallly an error will be produced to indicate that attachments exist that were not converted into binary <code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code> or <code><a class="el" href="struct__xop_____include.html" title="XOP include structure with attachment data. ">_xop__Include</a></code> structures (i.e. deserialized from the message by resolving references to MIME/MTOM attachments). This error can be avoided by using <code><a class="el" href="group__group__mime.html#ga57cf2a958b2ce6e957895642cd4c0966" title="Enable post-processing of MIME/MTOM attachments. ">soap_post_check_mime_attachments</a></code> to indicate that attachments may appear that cannot be automatically resolved and should be handled explicitly by calling <code><a class="el" href="group__group__mime.html#gaf2cb661a31f0cc431a3738125ddedb8f" title="Check for a MIME/MTOM attachment. ">soap_check_mime_attachments</a></code> and <code><a class="el" href="group__group__mime.html#ga117fe70b589a08a9fa9ad06c3f5bd009" title="Get a MIME/MTOM attachment. ">soap_recv_mime_attachment</a></code>.</p>
<dl class="section user"><dt>Examples:</dt><dd></dd></dl>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;soapH.h&quot;</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">  <span class="keyword">struct </span>soap *soap = <a class="code" href="group__group__context.html#ga87c20488b2dc680aaa7689b1d024989c">soap_new</a>();</div><div class="line">  <a class="code" href="group__group__mime.html#ga57cf2a958b2ce6e957895642cd4c0966">soap_post_check_mime_attachments</a>(soap);</div><div class="line">  <span class="keywordflow">if</span> (soap_call_ns__webmethod(soap, ...))</div><div class="line">  {</div><div class="line">    <a class="code" href="group__group__fault.html#ga931a4ab6df2553b48a0c270f8a0a88af">soap_print_fault</a>(soap, stderr); <span class="comment">// an error occurred</span></div><div class="line">  }</div><div class="line">  <span class="keywordflow">else</span></div><div class="line">  {</div><div class="line">    <span class="keywordflow">if</span> (<a class="code" href="group__group__mime.html#gaf2cb661a31f0cc431a3738125ddedb8f">soap_check_mime_attachments</a>(soap))</div><div class="line">    {</div><div class="line">      <span class="comment">// attachments are present, channel is still open</span></div><div class="line">      <span class="keywordtype">int</span> n = 0;</div><div class="line">      <span class="keywordflow">do</span></div><div class="line">      {</div><div class="line">        <span class="keyword">struct </span><a class="code" href="structsoap__multipart.html">soap_multipart</a> *attachment = <a class="code" href="group__group__mime.html#ga117fe70b589a08a9fa9ad06c3f5bd009">soap_recv_mime_attachment</a>(soap, NULL);</div><div class="line">        ++n;</div><div class="line">        printf(<span class="stringliteral">&quot;Part %d:\n&quot;</span>, n);</div><div class="line">        printf(<span class="stringliteral">&quot;ptr        =%p\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#a640f46b605042f37ae1592f77e31c52d">ptr</a>);</div><div class="line">        printf(<span class="stringliteral">&quot;size       =%ul\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#afc4b69f5e9ade6526b23681c105d5ca5">size</a>);</div><div class="line">        printf(<span class="stringliteral">&quot;id         =%s\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#ad0bcd79b40a1bc1dc13fc343477f5564">id</a> ? attachment-&gt;<a class="code" href="structsoap__multipart.html#ad0bcd79b40a1bc1dc13fc343477f5564">id</a> : <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">        printf(<span class="stringliteral">&quot;type       =%s\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#a495c8d20e0334be1b1345193ca2fb764">type</a> ? attachment-&gt;<a class="code" href="structsoap__multipart.html#a495c8d20e0334be1b1345193ca2fb764">type</a> : <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">        printf(<span class="stringliteral">&quot;location   =%s\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#af11a70ea80f3e1934d72b292e6d93910">location</a> ? attachment-&gt;<a class="code" href="structsoap__multipart.html#af11a70ea80f3e1934d72b292e6d93910">location</a> : <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">        printf(<span class="stringliteral">&quot;description=%s\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#ab527c6e6cce784c68a5bd9bb80845ca4">description</a> ? attachment-&gt;<a class="code" href="structsoap__multipart.html#ab527c6e6cce784c68a5bd9bb80845ca4">description</a> : <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">      } <span class="keywordflow">while</span> (attachment);</div><div class="line">      <span class="keywordflow">if</span> (soap-&gt;<a class="code" href="structsoap.html#ab85f5d42702963d13ea540bd9876e6d2">error</a>)</div><div class="line">        <a class="code" href="group__group__fault.html#ga931a4ab6df2553b48a0c270f8a0a88af">soap_print_fault</a>(soap, stderr);</div><div class="line">    }</div><div class="line">  }</div><div class="line">  <a class="code" href="group__group__context.html#gaf7d0176161e9def36981e24faa1913d9">soap_destroy</a>(soap);</div><div class="line">  <a class="code" href="group__group__context.html#ga81a009ae1ea825a05e5241e2b7a8ece9">soap_end</a>(soap);</div><div class="line">  <a class="code" href="group__group__context.html#ga57108ca4681186e58b5b189c3528f10a">soap_free</a>(soap);</div><div class="line">}</div></div><!-- fragment --><div class="fragment"><div class="line"><span class="preprocessor">#include &quot;soapH.h&quot;</span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line">  <span class="keyword">struct </span>soap *soap = <a class="code" href="group__group__context.html#ga87c20488b2dc680aaa7689b1d024989c">soap_new</a>();</div><div class="line">  soap-&gt;<a class="code" href="group__group__callbacks.html#gaef809b275fd65e57991a80663288fa72">fmimewriteopen</a> = mime_write_open;</div><div class="line">  soap-&gt;<a class="code" href="group__group__callbacks.html#ga9084f0392e4a54287366121d30bc4830">fmimewrite</a> = mime_write;</div><div class="line">  soap-&gt;<a class="code" href="group__group__callbacks.html#ga8af884096b21cea1b69133843131a47b">fmimewriteclose</a> = mime_write_close;</div><div class="line">  <a class="code" href="group__group__mime.html#ga57cf2a958b2ce6e957895642cd4c0966">soap_post_check_mime_attachments</a>(soap);</div><div class="line">  <span class="keywordflow">if</span> (soap_call_ns__webmethod(soap, ...))</div><div class="line">  {</div><div class="line">    <a class="code" href="group__group__fault.html#ga931a4ab6df2553b48a0c270f8a0a88af">soap_print_fault</a>(soap, stderr); <span class="comment">// an error occurred</span></div><div class="line">  }</div><div class="line">  <span class="keywordflow">else</span></div><div class="line">  {</div><div class="line">    <span class="keywordflow">if</span> (<a class="code" href="group__group__mime.html#gaf2cb661a31f0cc431a3738125ddedb8f">soap_check_mime_attachments</a>(soap))</div><div class="line">    {</div><div class="line">      <span class="comment">// attachments are present, channel is still open</span></div><div class="line">      <span class="keywordtype">int</span> n = 0;</div><div class="line">      <span class="keywordflow">do</span></div><div class="line">      {</div><div class="line">        handle = ...; <span class="comment">// a &#39;handle&#39; to pass to the MIME/MTOM callbacks that process the attachment content</span></div><div class="line">        ++n;</div><div class="line">        printf(<span class="stringliteral">&quot;Part %d:\n&quot;</span>, n);</div><div class="line">        printf(<span class="stringliteral">&quot;ptr        =%p\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#a640f46b605042f37ae1592f77e31c52d">ptr</a>);</div><div class="line">        printf(<span class="stringliteral">&quot;size       =%ul\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#afc4b69f5e9ade6526b23681c105d5ca5">size</a>);</div><div class="line">        printf(<span class="stringliteral">&quot;id         =%s\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#ad0bcd79b40a1bc1dc13fc343477f5564">id</a> ? attachment-&gt;<a class="code" href="structsoap__multipart.html#ad0bcd79b40a1bc1dc13fc343477f5564">id</a> : <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">        printf(<span class="stringliteral">&quot;type       =%s\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#a495c8d20e0334be1b1345193ca2fb764">type</a> ? attachment-&gt;<a class="code" href="structsoap__multipart.html#a495c8d20e0334be1b1345193ca2fb764">type</a> : <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">        printf(<span class="stringliteral">&quot;location   =%s\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#af11a70ea80f3e1934d72b292e6d93910">location</a> ? attachment-&gt;<a class="code" href="structsoap__multipart.html#af11a70ea80f3e1934d72b292e6d93910">location</a> : <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">        printf(<span class="stringliteral">&quot;description=%s\n&quot;</span>, attachment-&gt;<a class="code" href="structsoap__multipart.html#ab527c6e6cce784c68a5bd9bb80845ca4">description</a> ? attachment-&gt;<a class="code" href="structsoap__multipart.html#ab527c6e6cce784c68a5bd9bb80845ca4">description</a> : <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">      } <span class="keywordflow">while</span> (attachment);</div><div class="line">      <span class="keywordflow">if</span> (soap-&gt;<a class="code" href="structsoap.html#ab85f5d42702963d13ea540bd9876e6d2">error</a>)</div><div class="line">        <a class="code" href="group__group__fault.html#ga931a4ab6df2553b48a0c270f8a0a88af">soap_print_fault</a>(soap, stderr);</div><div class="line">    }</div><div class="line">  }</div><div class="line">  <a class="code" href="group__group__context.html#gaf7d0176161e9def36981e24faa1913d9">soap_destroy</a>(soap);</div><div class="line">  <a class="code" href="group__group__context.html#ga81a009ae1ea825a05e5241e2b7a8ece9">soap_end</a>(soap);</div><div class="line">  <a class="code" href="group__group__context.html#ga57108ca4681186e58b5b189c3528f10a">soap_free</a>(soap);</div><div class="line">}</div></div><!-- fragment --><dl class="section warning"><dt>Warning</dt><dd>When <code><a class="el" href="group__group__mime.html#ga57cf2a958b2ce6e957895642cd4c0966" title="Enable post-processing of MIME/MTOM attachments. ">soap_post_check_mime_attachments</a></code> is used, every message received must be followed by a call to <code><a class="el" href="group__group__mime.html#gaf2cb661a31f0cc431a3738125ddedb8f" title="Check for a MIME/MTOM attachment. ">soap_check_mime_attachments</a></code>. When this function returns nonzero, <code><a class="el" href="group__group__mime.html#gaf2cb661a31f0cc431a3738125ddedb8f" title="Check for a MIME/MTOM attachment. ">soap_check_mime_attachments</a></code> must be called repeatedly until this function returns NULL. This sequence of calls is necessary to properly handle messages with and without attachments. The connection is closed if HTTP keep-alive is not enabled. With HTTP keep-alive enabled, this sequence of calls allows the next message to be properly received.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><code><a class="el" href="group__group__mime.html#gaf2cb661a31f0cc431a3738125ddedb8f" title="Check for a MIME/MTOM attachment. ">soap_check_mime_attachments</a></code>, <code><a class="el" href="group__group__mime.html#ga117fe70b589a08a9fa9ad06c3f5bd009" title="Get a MIME/MTOM attachment. ">soap_recv_mime_attachment</a></code>, <code><a class="el" href="group__group__callbacks.html#gaef809b275fd65e57991a80663288fa72" title="Callback to open a streaming MIME/MTOM attachment for writing. ">soap::fmimewriteopen</a></code>, <code><a class="el" href="group__group__callbacks.html#ga9084f0392e4a54287366121d30bc4830" title="Callback to write data in a MIME attachment stream. ">soap::fmimewrite</a></code>, <code><a class="el" href="group__group__callbacks.html#ga8af884096b21cea1b69133843131a47b" title="Callback to close a MIME/MTOM attachment stream after writing. ">soap::fmimewriteclose</a></code>.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd><code><a class="el" href="group__group__errors.html#ga3b10a68f354f39cbb0fe0d043ad4c7c0" title="The soap_status code for no error (zero) ">SOAP_OK</a></code> or a <code><a class="el" href="group__group__errors.html#gac0eadf8f72bacb5b41b750beaeca0444" title="Status and error codes are int values, a zero value or SOAP_OK (0) means no error, nonzero means error. ">soap_status</a></code> error code </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">soap</td><td><code><a class="el" href="structsoap.html" title="Context with the engine state. ">soap</a></code> context </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga117fe70b589a08a9fa9ad06c3f5bd009"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="structsoap__multipart.html">soap_multipart</a>* soap_recv_mime_attachment </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structsoap.html">soap</a> *&#160;</td>
          <td class="paramname"><em>soap</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>handle</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get a MIME/MTOM attachment. </p>
<p>This function parses an attachment and invokes the MIME callbacks when set. The <code>handle</code> parameter is passed to <code>fmimewriteopen</code>. The handle may contain any data that is extracted from the SOAP message body to guide the redirection of the stream in the callbacks. Returns a struct with a <code>char *ptr</code> member that contains the handle value returned by the <code>fmimewriteopen</code> callback, and <code>char *id</code>, <code>char *type</code>, and <code>char *description</code> member variables with the MIME id, type, and description info when present in the attachment.</p>
<dl class="section see"><dt>See also</dt><dd><code><a class="el" href="group__group__mime.html#ga57cf2a958b2ce6e957895642cd4c0966" title="Enable post-processing of MIME/MTOM attachments. ">soap_post_check_mime_attachments</a></code>, <code><a class="el" href="group__group__mime.html#gaf2cb661a31f0cc431a3738125ddedb8f" title="Check for a MIME/MTOM attachment. ">soap_check_mime_attachments</a></code>.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>MIME attachment data or NULL if no more attachments were found </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">soap</td><td><code><a class="el" href="structsoap.html" title="Context with the engine state. ">soap</a></code> context </td></tr>
    <tr><td class="paramname">handle</td><td>a handle to pass to the callbacks </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga9180e5ba634b20305b755b410045d9ee"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int soap_set_mime </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structsoap.html">soap</a> *&#160;</td>
          <td class="paramname"><em>soap</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>boundary</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>start</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enable MIME attachments. </p>
<p>This function enables sending MIME attachments. This function is generally not required when the context is initialized with <code><a class="el" href="group__group__flags.html#ga988c0f4d52bf6f5cdac8c0e197ebe62a" title="soap_mode ENC output flag value to enable MIME attachments in messages to be sent, receiving is automatic ">SOAP_ENC_MIME</a></code>, because MIME attachments are automatically detected as <code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code> and <code><a class="el" href="struct__xop_____include.html" title="XOP include structure with attachment data. ">_xop__Include</a></code> structures in the data to serialize as an XML message with the attachments automatically added or MIME attachments can be explicitly added with <code><a class="el" href="group__group__mime.html#ga39e5da4f375e8030b8cbddaf0a2a8e6e" title="Add a MIME attachment to the SOAP/XML message. ">soap_set_mime_attachment</a></code>. Parameter <code>boundary</code> specifies a MIME boundary string or NULL to have the engine generate a MIME boundary string. Parameter <code>start</code> specifiesthe start content ID for the first MIME body containing the SOAP or XML message. When NULL, the start ID of the SOAP message is <em><code>&lt;SOAP-ENV:Envelope&gt;</code></em>.</p>
<dl class="section see"><dt>See also</dt><dd><code><a class="el" href="group__group__mime.html#ga39e5da4f375e8030b8cbddaf0a2a8e6e" title="Add a MIME attachment to the SOAP/XML message. ">soap_set_mime_attachment</a></code>, <code><a class="el" href="group__group__mime.html#ga81cedb24670ebda48a79679d4682211f" title="Disable MIME attachments. ">soap_clr_mime</a></code>, <code><a class="el" href="group__group__flags.html#ga988c0f4d52bf6f5cdac8c0e197ebe62a" title="soap_mode ENC output flag value to enable MIME attachments in messages to be sent, receiving is automatic ">SOAP_ENC_MIME</a></code>, <code><a class="el" href="group__group__flags.html#gac510f1f7c80fa8a3f20afa2dcfb53fb3" title="soap_mode ENC output flag value to enable MTOM XOP attachments in messages to be sent, receiving is automatic ">SOAP_ENC_MTOM</a></code>. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">soap</td><td><code><a class="el" href="structsoap.html" title="Context with the engine state. ">soap</a></code> context </td></tr>
    <tr><td class="paramname">boundary</td><td>MIME boundary string to use or NULL to generate a random boundary </td></tr>
    <tr><td class="paramname">start</td><td>string id of the first MIME attachment with the SOAP/XML message or NULL </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ga39e5da4f375e8030b8cbddaf0a2a8e6e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int soap_set_mime_attachment </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structsoap.html">soap</a> *&#160;</td>
          <td class="paramname"><em>soap</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">enum <a class="el" href="group__group__mime.html#ga3fec7633da07bff2bf5fd6330bef1844">soap_mime_encoding</a>&#160;</td>
          <td class="paramname"><em>encoding</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>location</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>description</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Add a MIME attachment to the SOAP/XML message. </p>
<p>This function adds a MIME attachment to a SOAP/XML message to send. The specified <code>ptr</code> points to the data to send of length specified by <code>size</code>. The <code>encoding</code> parameter is a <code><a class="el" href="group__group__mime.html#ga3fec7633da07bff2bf5fd6330bef1844" title="RFC2045 MIME content transfer encodings. ">soap_mime_encoding</a></code> value that is recommended to be specified as <code><a class="el" href="group__group__mime.html#gga3fec7633da07bff2bf5fd6330bef1844a974209a86acc850e3c3d4beb8e579e8c" title="no encoding, raw data content (recommended) ">SOAP_MIME_NONE</a></code> to specify that the MIME data content is not encoded in any way (the MIME attachment function simply copies the raw data to the MIME block without encoding). The <code>type</code> parameter is required and indicates the MIME type of the data, such as "image/jpg". The <code>id</code> parameter uniquely identifies the attachment in the message, which can be omitted by specifying NULL. The <code>location</code> parameter specifies a location string or NULL. The <code>description</code> parameter is a string that describes the data or NULL. Returns <code><a class="el" href="group__group__errors.html#ga3b10a68f354f39cbb0fe0d043ad4c7c0" title="The soap_status code for no error (zero) ">SOAP_OK</a></code> or a <code><a class="el" href="group__group__errors.html#gac0eadf8f72bacb5b41b750beaeca0444" title="Status and error codes are int values, a zero value or SOAP_OK (0) means no error, nonzero means error. ">soap_status</a></code> error code.</p>
<p>There are two ways to add MIME/MTOM attachments to SOAP/XML:</p><ul>
<li>use <code><a class="el" href="group__group__mime.html#ga39e5da4f375e8030b8cbddaf0a2a8e6e" title="Add a MIME attachment to the SOAP/XML message. ">soap_set_mime_attachment</a></code> to explicitly add an attachment that contains the specified source of data;</li>
<li>use <code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code> or <code><a class="el" href="struct__xop_____include.html" title="XOP include structure with attachment data. ">_xop__Include</a></code> structures in the serializable data of a SOAP/XML message, where the specified data is serialized in MIME/MTOM attachments automatically when one of the <code>id</code>, <code>type</code> or <code>options</code> member variables are non-NULL. This option requires <code><a class="el" href="group__group__flags.html#ga988c0f4d52bf6f5cdac8c0e197ebe62a" title="soap_mode ENC output flag value to enable MIME attachments in messages to be sent, receiving is automatic ">SOAP_ENC_MIME</a></code> or <code><a class="el" href="group__group__flags.html#gac510f1f7c80fa8a3f20afa2dcfb53fb3" title="soap_mode ENC output flag value to enable MTOM XOP attachments in messages to be sent, receiving is automatic ">SOAP_ENC_MTOM</a></code>.</li>
</ul>
<p>Both methods support streaming MIME/MTOM attachments, where a user-defined handle instead of the actual data is specified for the <code>ptr</code> parameter or the <code>__ptr</code> member variable.</p>
<dl class="section user"><dt>Example:</dt><dd></dd></dl>
<div class="fragment"><div class="line"><span class="preprocessor">#include &quot;soapH.h&quot;</span></div><div class="line"></div><div class="line"><span class="keyword">struct </span>soap *soap = <a class="code" href="group__group__context.html#ga51cde138234ed7ec8c4e25bdf6418658">soap_new1</a>(<a class="code" href="group__group__flags.html#gaea7443dc67c979b06cf347ed16db1b51">SOAP_IO_CHUNK</a>);</div><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span> *data = ...; <span class="comment">// points to data to send</span></div><div class="line"><span class="keywordtype">size_t</span> size = ...;      <span class="comment">// length of the data</span></div><div class="line">soap-&gt;<a class="code" href="structsoap.html#af32b5f3975eac2bd1202571515859163">connect_timeout</a> = 30;                 <span class="comment">// 30 seconds max connect stall time</span></div><div class="line">soap-&gt;<a class="code" href="structsoap.html#a711bb3a53de7cc62429e4d3a2e0b5474">send_timeout</a> = soap_recv_timeout = 5; <span class="comment">// 5 seconds max socket stall time (unlimited by default)</span></div><div class="line">soap-&gt;<a class="code" href="structsoap.html#afcf1d236d052579122f785d7639c43c7">transfer_timeout</a> = 30;                <span class="comment">// 30 seconds max message transfer time (unlimited by default)</span></div><div class="line">soap-&gt;<a class="code" href="structsoap.html#a345900c2db67e915ceb02bfa21ecbcbd">recv_maxlength</a> = 1048576;             <span class="comment">// limit messages received to 1MB (2GB by default)</span></div><div class="line"><a class="code" href="group__group__mime.html#ga39e5da4f375e8030b8cbddaf0a2a8e6e">soap_set_mime_attachment</a>(soap, data, size, <a class="code" href="group__group__mime.html#gga3fec7633da07bff2bf5fd6330bef1844a974209a86acc850e3c3d4beb8e579e8c">SOAP_MIME_NONE</a>, <span class="stringliteral">&quot;image/jpg&quot;</span>, NULL, NULL, <span class="stringliteral">&quot;Picture&quot;</span>);</div><div class="line"><span class="keywordflow">if</span> (soap_call_ns__webmethod(soap, <a class="code" href="structsoap.html#aed1b86b8a34aea86103751a932c9dce9">endpoint</a>, NULL, ...))</div><div class="line">{</div><div class="line">  <a class="code" href="group__group__fault.html#ga931a4ab6df2553b48a0c270f8a0a88af">soap_print_fault</a>(soap, stderr);</div><div class="line">  <span class="keywordflow">if</span> (soap-&gt;<a class="code" href="structsoap.html#a10b66d6d489690b7d0f591ae2633dd13">errnum</a> == 0) <span class="comment">// timed out, exit program</span></div><div class="line">    exit(EXIT_FAILURE);</div><div class="line">}</div><div class="line"><span class="keywordflow">else</span></div><div class="line">{</div><div class="line">  ... <span class="comment">// success</span></div><div class="line">}</div><div class="line"><a class="code" href="group__group__mime.html#ga81cedb24670ebda48a79679d4682211f">soap_clr_mime</a>(soap);</div><div class="line"><a class="code" href="group__group__context.html#gaf7d0176161e9def36981e24faa1913d9">soap_destroy</a>(soap);</div><div class="line"><a class="code" href="group__group__context.html#ga81a009ae1ea825a05e5241e2b7a8ece9">soap_end</a>(soap);</div><div class="line"><a class="code" href="group__group__context.html#ga57108ca4681186e58b5b189c3528f10a">soap_free</a>(soap);</div></div><!-- fragment --><dl class="section see"><dt>See also</dt><dd><code><a class="el" href="structxsd____base64_binary.html" title="XSD base64Binary structure with attachment data. ">xsd__base64Binary</a></code>, <code><a class="el" href="struct__xop_____include.html" title="XOP include structure with attachment data. ">_xop__Include</a></code>, <code><a class="el" href="group__group__misc.html#ga5fcf3c8f6f4bc6d5e6efd7a92ceaf399" title="Returns a randomized unique UUID string. ">soap_rand_uuid</a></code>, <code><a class="el" href="group__group__callbacks.html#ga610f2a6a56d5ad04cb5124440a5de1dc" title="Callback to open a streaming MIME/MTOM attachment for reading. ">soap::fmimereadopen</a></code>, <code><a class="el" href="group__group__callbacks.html#gaff40a1ca6fbf075b54ccbf479009ce74" title="Callback to read data in a MIME/MTOM attachment stream. ">soap::fmimeread</a></code>, <code><a class="el" href="group__group__callbacks.html#ga884e94e8450f56049ba5071786170dd5" title="Callback to close a MIME/MTOM attachment stream after reading. ">soap::fmimereadclose</a></code>.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd><code><a class="el" href="group__group__errors.html#ga3b10a68f354f39cbb0fe0d043ad4c7c0" title="The soap_status code for no error (zero) ">SOAP_OK</a></code> or a <code><a class="el" href="group__group__errors.html#gac0eadf8f72bacb5b41b750beaeca0444" title="Status and error codes are int values, a zero value or SOAP_OK (0) means no error, nonzero means error. ">soap_status</a></code> error code </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">soap</td><td><code><a class="el" href="structsoap.html" title="Context with the engine state. ">soap</a></code> context </td></tr>
    <tr><td class="paramname">ptr</td><td>pointer to data </td></tr>
    <tr><td class="paramname">size</td><td>length of the data </td></tr>
    <tr><td class="paramname">encoding</td><td>encoding of the data </td></tr>
    <tr><td class="paramname">type</td><td>MIME type of the data </td></tr>
    <tr><td class="paramname">id</td><td>content ID of the data or NULL </td></tr>
    <tr><td class="paramname">location</td><td>location of the data or NULL </td></tr>
    <tr><td class="paramname">description</td><td>description of the data or NULL </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<hr class="footer">
<address class="footer">
Copyright (C) 2021, Robert van Engelen, Genivia Inc., All Rights Reserved.
</address>
<address class="footer"><small>
Converted on Thu Dec 23 2021 13:46:46 by <a target="_blank" href="http://www.doxygen.org/index.html">Doxygen</a> 1.8.11</small></address>
<br>
<div style="height: 246px; background: #DBDBDB;">
</body>
</html>
